package com.sikaryofficial.backend.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author : qinjinyuan
 * @desc : 文章来源枚举
 * @date : 2023/11/04 10:08
 */
@Getter
@AllArgsConstructor
public enum ArticleAuditStatusEnum {
    /**
     * 审核状态:0-草稿,1-审核中(点击发布),2-审核通过(发布成功),3-审核不通过
     */
    DRAFT(0, "草稿","Draft"),
    IN_REVIEW(1, "待审核","In Review"),
    APPROVED(2, "审核通过","Approved"),
    REVIEW_FAILED(3, "审核不通过","Review Failed"),
    ;
    private final Integer code;
    private final String name;
    private final String nameEn;
    public static ArticleAuditStatusEnum getNameByCode(Integer code) {

        return Arrays.stream(ArticleAuditStatusEnum.values())
                .filter(pointRuleEnum -> Objects.nonNull(code) && pointRuleEnum.getCode().equals(code))
                .findFirst().orElse(null);

    }
}
